﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gradepaper.aspx.cs" Inherits="OnlineTestUI.BackManager.gradepaper" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript" src="/Scripts/jquery-1.10.2.js"></script>
</head>
<body>
    <form id="form1" runat="server" onsubmit="getPaper()">
        <f:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" runat="server"></f:PageManager>
        <div>
            <%foreach (var item in PqeList)
              {
                  switch (item.QuestionTypeId)
                  {
                      case 2:
                          sq = GetSq(item.QuestionId);%><div style="visibility: visible;" tabindex="-1" class="div_question div_question_mouseout">
                              <div class="div_preview">
                                  <div class="div_title_question_all">
                                      <div class="div_topic_question">1.</div>
                                      <div class="div_title_question"><span><%=item.QuestionName%></span></div>
                                      <div style="clear: both;"></div>
                                  </div>
                                  <div class="div_table_radio_question">
                                      <div class="div_table_clear_top"></div>
                                      <ul>
                                          所填答案：<%=sq.Answer%>
                                      正确答案：<%=item.CorrectAnswer%>
                                      此题分数：<%=sq.Score%>
                                      应得分数：<input id="<%=sq.Id%>" data-score="<%=item.Score%>" name="<%=item.QuestionId%>" type="text" />

                                          <div style="clear: both;"></div>
                                      </ul>
                                      <div class="div_table_clear_bottom"></div>
                                  </div>

                                  <div style="clear: both;"></div>
                              </div>
                          </div>
            <%; break;
                      case 4: sq = GetSq(item.QuestionId);
            %><div style="visibility: visible;" tabindex="-1" class="div_question div_question_mouseout">
                <div class="div_preview">
                    <div class="div_title_question_all">
                        <div class="div_topic_question">1.</div>
                        <div class="div_title_question"><span><%=item.QuestionName%></span></div>
                        <div style="clear: both;"></div>
                    </div>
                    <div class="div_table_radio_question">
                        <div class="div_table_clear_top"></div>
                        <ul>
                            所填答案：<%=sq.Answer%>
                                      正确答案：<%=item.CorrectAnswer%>
                                      此题分数：<%=sq.Score%>
                                      应得分数：<input id="<%=sq.Id%>" data-score="<%=item.Score%>" name="<%=item.QuestionId%>" type="text" />


                            <div style="clear: both;"></div>
                        </ul>
                        <div class="div_table_clear_bottom"></div>
                    </div>

                    <div style="clear: both;"></div>
                </div>
            </div>
            <%; break;
                  }
              }%>
        </div>
        
        <input id="paperscorelist" type="hidden" name="paperscorelist" />
        <asp:Button ID="Button2" runat="server" Text="提交答卷" OnClick="BtAdd_Click" />

        <script type="text/javascript">
            function getPaper() {
                var paper = { "question": [] };
                $(".div_question").each(function (n) {
                    var newquestion;
                    
                    var checks2 = $(".div_question:eq(" + n + ") input[type='text']");
                    var _this = $(checks2[0]);
                    var questionid = _this.attr('name');
                    id = _this.attr("id");
                    score = _this.val();
                    totalscore = _this.data("score");
                    newquestion = { "id": id, "score": score,"questionid" : questionid ,"paperid":totalscore};
                    paper.question.push(newquestion);
                });
                var paperstring = JSON.stringify(paper);//将对象转换为字符串
                $("#paperscorelist").val(paperstring);
            }
        </script>
    </form>
</body>
</html>
